<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<ui:composition template="/templatePrincipal.xhtml" xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:rich="http://richfaces.org/rich">

    <ui:define name="conteudo">
        <script type="text/javascript">
            function limparCampos(){
                document.getElementById("fpUsuarios:itLogin").value = '';
                document.getElementById("fpUsuarios:itSenha").value = '';
                document.getElementById("fpUsuarios:itEmail").value = '';
                document.getElementById("fpUsuarios:sorAcesso").value = '';
            }
        </script>
        <rich:spacer height="20"/>
        <center>
            <rich:messages layout="table"
                           errorClass="errorClass"
                           infoClass="infoClass"
                           warnClass="warnClass"
                           styleClass="painelMensagem"
                           ajaxRendered="true"/>
        </center>
        <rich:spacer height="10"/>
        <rich:simpleTogglePanel switchType="client">
            <f:facet name="header">
                #{messages.cadastroUsuario}
            </f:facet>

            <h:form id="fpUsuarios">
                <h:panelGrid cellspacing="2" cellpadding="2" columns="2" columnClasses="field-names, fields">

                    <h:outputLabel for="itLogin" styleClass="required-black">
                        #{messages.loginUsuario}:
                    </h:outputLabel>
                    <h:inputText id="itLogin" required="true" value="#{usuarioCriarAction.paramNome}" style="width:150px;"/>

                    <h:outputLabel for="itSenha" styleClass="required-black">
                        #{messages.senhaUsuario}:
                    </h:outputLabel>
                    <h:inputSecret id="itSenha" required="true" value="#{usuarioCriarAction.paramSenha}" style="width:150px;"/>

                    <h:outputLabel for="itEmail" styleClass="required-black">
                        #{messages.emailUsuario}:
                    </h:outputLabel>
                    <h:inputText id="itEmail" required="true" value="#{usuarioCriarAction.paramEmail}" style="width:150px;"/>

                    <h:outputLabel for="sorAcesso" styleClass="required-black">
                        #{messages.acesso}:
                    </h:outputLabel>
                    <h:selectOneRadio id="sorAcesso" required="true" styleClass="table-radio" value="#{usuarioCriarAction.paramAcesso}" style="vertical-align:top">
                        <f:selectItem itemValue="1" itemLabel="#{messages.administrador}"/>
                        <f:selectItem itemValue="2" itemLabel="#{messages.cliente}"/>
                    </h:selectOneRadio>

                    <!--h:selectOneMenu id="somFuncionarioCliente" value="#{usuarioCriarAction.usuario.cargo}" label="#{messages.domicilioEstado}">
                        <s:selectItems value="#{usuarioCriarAction.estados}" var="e" label="#{e.estEst}" itemValue="#{e.codEst}" noSelectionLabel="..."/>
                    </h:selectOneMenu>

                    <h:outputLabel for="itDataNascimento">
                        #{messages.dataNascimentoUsuario}:
                    </h:outputLabel>
                    <h:panelGroup>
                        <h:inputText id="itDataCadastro" value="#{usuarioCriarAction.usuario.dataNascimento}" size="10">
                            <rich:jQuery selector="#itPacienteDoacaoSangueA" query="mask('99/99/9999')" timing="onload"/>
                            <f:convertDateTime type="date" pattern="#{messages.dataFormatoPadraoData}" timeZone="#{messages.dataTimeZone}"/>
                        </h:inputText>
                        <h:outputText value=" (dd/mm/aaaa)" styleClass="field-info" />
                    </h:panelGroup-->
                </h:panelGrid>
                <br/>
                <h:commandLink id="clCriar"
                               action="#{usuarioCriarAction.setup}"
                               styleClass="link dr-toolbar-ext rich-toolbar">
                    <h:graphicImage value="/resources/images/dialog-ok-old.png"/>
                    <h:outputText value="#{messages.botaoOk}"/>
                </h:commandLink>

                <h:commandLink id="clLimpar"
                               immediate="true"
                               onclick="limparCampos()"
                               styleClass="link dr-toolbar-ext rich-toolbar">
                    <h:graphicImage value="/resources/images/edit-clear.png"/>
                    <h:outputText value="#{messages.botaoLimpar}"/>
                </h:commandLink>

                <h:commandLink id="clVoltar"
                               immediate="true"
                               action="usuarios"
                               styleClass="link dr-toolbar-ext rich-toolbar">
                    <h:graphicImage value="/resources/images/edit-undo.png"/>
                    <h:outputText value=" #{messages.botaoVoltar}" />
                </h:commandLink>
            </h:form>
        </rich:simpleTogglePanel>
    </ui:define>
</ui:composition>